package com.carp.shard.plugin.strategy;

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import lombok.NonNull;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.reflection.MetaObject;

/**
 * 默认分片策略
 * 不注入容器，避免策略对象初始化顺序靠后可能导致的依赖问题
 *
 * @author lile
 * @since 2024/5/29
 */
public class DefaultShardStrategy extends AbstractShardStrategy {

    public static final DefaultShardStrategy INSTANCE = new DefaultShardStrategy();

    /**
     * 表名
     */
    public static final String TABLE_NAME = "DEFAULT";

    @Override
    protected String getOriginalTableName() {
        return TABLE_NAME;
    }

    @Override
    public String getShardTableName(@NonNull Object parameterObject) {
        return null;
    }

    @Override
    public boolean replaceTableName(@NonNull SQLExprTableSource x, @NonNull BoundSql boundSql) {
        return false;
    }

    @Override
    public void processParams(@NonNull MetaObject metaObject, @NonNull BoundSql boundSql, @NonNull SchemaStatVisitor statVisitor) {

    }
}
